The present invention generally relates to graphic display apparatuses, and more particularly to a graphic display apparatus which carries out a shading process.
Recently, it has become popular to generate a three-dimensional image on a computer. The user is demanding more realistic images, and there are also demands to realize a real-time process.
When generating the three-dimensional image, there is a large load on a process of calculating the luminance of graphics. Hence, in order to generate the image in real-time, it is necessary to efficiently carry out the luminance calculation.
A description will be given of a display technique employed in an example of a conventional graphic display apparatus. FIG. 1 shows the construction of the conventional graphic display apparatus, and FIGS. 2A and 2B are diagrams for explaining the process of this conventional graphic display apparatus.
A modeling transforming part 20 of the conventional graphic display apparatus shown in FIG. 1 combines graphics which are described in respective modeling coordinate systems MC as shown in FIG. 2A, based on input graphic data, and transforms the coordinate systems so that the input graphic data are described in a common world coordinate system WC. On the other hand, a luminance calculating part 21 calculates a luminance of the graphic data described in the world coordinate system WC as indicated by I in FIG. 2B. In FIG. 2B, each portion having a low luminance is indicated by a dotted shading. A visual field (or field of vision) transforming part 22 transforms the graphic data for which the luminance is calculated into graphic data describing the same graphic viewed from a different visual point (or point of vision). In this case, the coordinate system is transformed from the world coordinate system WC into a normalized projection coordinate system NPC when the visual field transforming part 22 carries out the transformation. The normalized projection coordinate system NPC is a normalized coordinate system as indicated by II in FIG. 2B.
A clip part 23 clips a desired portion of the image which is transformed in the visual field transforming part 22, as indicated by III in FIG. 2B. After this clipping, the clipped image portion is supplied to a work station transforming part 24 which transforms the normalized projection coordinate system NPC into a device coordinate system DC. The device coordinate system DC conforms to a coordinate system employed in a display device 28. For example, the display device 28 is a cathode ray tube (CRT).
After the transformation in the work station transforming part 24, a dot developing part 25 develops the graphic data into dot data. A Z-buffer 26 stores depth values of the graphic data. If the graphic has an overlapping portion, a three-dimensional image is displayed by displaying the graphic data having the depth value which corresponds to the front along the depth direction. The graphic data which are subjected to the dot developing process and the depth control process are stored in a frame buffer 27 and displayed on the display device 28.
Next, a description will be given of the luminance calculation. The luminance calculation is carried out in the luminance calculating part 21 by transforming the modeling coordinate systems of vertex coordinate values and normal vectors related to a polygon which is input into the world coordinate system in the modeling transforming part 20. This input polygon has three-dimensional polygonal surfaces approximating the shape of an object. The modeling coordinate systems are the coordinate systems which describe the graphics and are used when the user defines the graphics. In addition, the world coordinate system is the coordinate system in which these graphics are combined to form the object.
When calculating the luminance, the shading technique is set as the attribute. When this shading technique is once set, this shading technique is effective with respect to all polygons input thereafter, and the shading technique is fixed until the next shading technique is set.
Next, a description will be given of the shading techniques which are popularly used.
1) Constant Shading (or Flat Shading) Technique
This technique calculates the luminance only once with respect to one polygon, and a color obtained by the luminance calculation is assigned to the entire polygon.
2) Gouraud Shading Technique:
The luminance is calculated with respect to each of the vertexes of the polygon, and a linear interpolation is made within the polygon.
3) Phong Shading Technique:
The normal is interpolated in place of the luminance value at each vertex of the polygon, and the luminance is calculated for each dot. Since the luminance is calculated in units of dots, it is possible to obtain a realistic image. However, the amount of calculation required is extremely large.
The Phong shading technique is desirable if the three-dimensional image is to be displayed realistically. However, the Phong shading technique calculates the luminance in units of dots, and the real-time processing is virtually impossible because of the extremely large amount of calculation that is required.
On the other hand, a graphic display apparatus has been proposed in a Japanese Laid-Open Patent Application No. 4-225482. This proposed graphic display apparatus selects the shading technique depending on the distance from the visual point to the polygon.
The operating principle of this proposed graphic display apparatus is as follows. That is, in order to make a realistic display of a three-dimensional image, it is not necessary to make the entire image realistic, and it is sufficient to make the realistic display for only the image portion which is close to the visual point. In addition, since the image portion which is distant from the visual point and forms the background does not need to be displayed realistically, no problem is introduced even if the shading technique used for such an image portion cannot realize a highly realistic display.
Accordingly, by using the Phong shading technique or the like which enables a highly realistic display with respect to the image portion which is close to the visual point of the image, and using the constant shading technique, the Gouraud shading technique or the like which is inferior with regard to the realistic nature but can carry out the required calculation within a short time with respect to the image portion (or background) which is distant from the visual point, it becomes possible to make a realistic display of the image as a whole and to carry out the necessary processing in real-time.
FIG. 3 is a block diagram for explaining the operating principle of this proposed graphic display apparatus. FIG. 3 shows a shading technique selection part 30 which selects the shading technique to be used.
In FIG. 3, the user first sets a distance threshold value 31, a first shading technique 34 and a second shading technique 35. It is assumed for the sake of convenience that the first shading technique 34 is the Gouraud shading technique or the constant shading technique which only requires a small amount of calculation, and that the second shading technique 35 is the Phong shading technique which requires a large amount of calculation.
A visual point distance calculating part 32 calculates a distance between the visual point and an target polygon. A shading technique judging part 33 selects the shading technique by comparing the distance calculated by the visual point distance calculating part 32 and the distance threshold value 31 which is set in advance. More particularly, the shading technique judging part 33 selects the first shading technique 34 if the distance calculated by the visual point distance calculating part 32 is greater than the distance threshold value 31, and selects the second shading technique 35 if the distance calculated by the visual point distance calculating part 32 is smaller than or equal to the distance threshold value 31.
Accordingly, the shading process is carried out with respect to the image portion which is close to the visual point of the image by using the Phong shading technique which enables the realistic display. On the other hand, the shading process is carried out with respect to the image portion (or background) which is distant to the visual point of the image by using the constant shading technique or the Gouraud shading technique which does not enable a realistic display when compared to the Phong shading technique but can carry out the calculation within a short time. As a result, both realistic display and real-time processing can be satisfied with respect to the image as a whole.
However, even if the distance from the visual point to the polygon is far, there are cases where the polygon appears relatively large on the screen (or display). In such cases, the realistic nature of the entire image deteriorates if the polygon although distant from the visual point is subjected to the shading process using the constant shading technique or the Gouraud shading technique which does not enable a realistic display.
FIGS. 4A and 4B are diagrams for explaining the relationship of the distance from the visual point to the polygon and the realistic nature of the displayed image.
As shown in FIG. 4A, if the area of a background portion 36 which is distant from the visual point is small on the screen, it is possible to obtain a satisfactory image which is realistic as a whole by using the Phong shading technique with respect to a portion 37 which is close to the visual point of the image.
But if the area on the screen of a background portion 36' which is distant from the visual point is large on the screen as shown in FIG. 4B, the Phong shading technique is used with respect to a small polygon 37' which is close to the visual point of the image, and the constant shading technique or the Gouraud shading technique is used with respect to the large background 36' which is distant from the visual point. As a result, the proposed graphic display apparatus had a problem in that the realistic nature of the image as a whole greatly deteriorates in such a case.